<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <head th:include="common :: header"></head>
</head>

<body>
<!--Page content-->
<div id="page-content" class=" animated fadeIn">
    <div class="row">
        <div class="col-xs-12">
            <div class="panel">
                <form id="dataForm" class="form-horizontal" th:action="@{${action}}" method="post" >
                    <div class="panel-body">
                        <p class="text-main text-bold">基本资料</p>
                        <div class="form-group">
                            <label class="col-lg-3 col-sm-2 control-label">文件管理方式</label>
                            <div class="col-lg-7 col-sm-9">
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="manage_mode" value="1" th:attr="checked=${fileConfigMap['manage_mode'] == '1'}"/> 默认（本地）
                                    </label>&nbsp;
                                    <label>
                                        <input type="radio" name="manage_mode" value="2" th:attr="checked=${fileConfigMap['manage_mode'] == '2'}"/> 七牛云
                                    </label>&nbsp;
                                    <label>
                                        <input type="radio" name="manage_mode" value="3" th:attr="checked=${fileConfigMap['manage_mode'] == '3'}"/> OSS
                                    </label>
                                </div>
                            </div>
                        </div>
                        <hr>
                        <p class="text-main text-bold">默认配置</p>
                        <div class="form-group">
                            <label class="col-lg-3 col-sm-2 control-label">文件上传目录</label>
                            <div class="col-lg-7 col-sm-9">
                                <input type="text" class="form-control" name="upload_dir" placeholder="文件上传目录" th:value="${fileConfigMap['upload_dir']}" />
                            </div>
                        </div>
                        <hr>
                        <p class="text-main text-bold">七牛云配置</p>
                        <div class="form-group">
                            <label class="col-lg-3 col-sm-2 control-label">Domain</label>
                            <div class="col-lg-7 col-sm-9">
                                <input type="text" id="qn_domain" name="qn_domain" class="form-control" placeholder="Domain" th:value="${fileConfigMap['qn_domain']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-3 col-sm-2 control-label">AccessKey</label>
                            <div class="col-lg-7 col-sm-9">
                                <input type="text" id="qn_accessKey" name="qn_access_key" class="form-control" placeholder="AccessKey" th:value="${fileConfigMap['qn_access_key']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-3 col-sm-2 control-label">SecretKey</label>
                            <div class="col-lg-7 col-sm-9">
                                <input type="text" id="qn_secretKey" name="qn_secret_key" class="form-control" placeholder="SecretKey" th:value="${fileConfigMap['qn_secret_key']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-3 col-sm-2 control-label">Bucket</label>
                            <div class="col-lg-7 col-sm-9">
                                <input type="text" id="qn_bucket" name="qn_bucket" class="form-control" placeholder="Bucket" th:value="${fileConfigMap['qn_bucket']}">
                            </div>
                        </div>
                        <hr>
                        <p class="text-main text-bold">OSS 配置</p>
                        <div class="form-group">
                            <label class="col-lg-3 col-sm-2 control-label">Endpoint</label>
                            <div class="col-lg-7 col-sm-9">
                                <input type="text" id="oss_endpoint" name="oss_endpoint" class="form-control" placeholder="Endpoint" th:value="${fileConfigMap['oss_endpoint']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-3 col-sm-2 control-label">AccessKey</label>
                            <div class="col-lg-7 col-sm-9">
                                <input type="text" id="oss_accessKey" name="oss_access_key" class="form-control" placeholder="AccessKey" th:value="${fileConfigMap['oss_access_key']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-3 col-sm-2 control-label">SecretKey</label>
                            <div class="col-lg-7 col-sm-9">
                                <input type="text" id="oss_secretKey" name="oss_secret_key" class="form-control" placeholder="SecretKey" th:value="${fileConfigMap['oss_secret_key']}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-3 col-sm-2 control-label">Bucket</label>
                            <div class="col-lg-7 col-sm-9">
                                <input type="text" id="oss_bucket" name="oss_bucket" class="form-control" placeholder="Bucket" th:value="${fileConfigMap['oss_bucket']}">
                            </div>
                        </div>
                    </div>
                    <div class="panel-footer">
                        <div class="row">
                            <span th:each="button: ${buttonList}" >
                                <div class="col-sm-12" th:if="${#strings.containsIgnoreCase(button.perCode,'save')}" th:shiro:hasPermission="${button.perCode}">
                                    <button class="btn btn-primary" type="button" id="submitBtn">保存</button>
                                    <button class="btn btn-default" type="reset">重置</button>
                                </div>
                            </span>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!--End page content-->
<div th:include="common :: script"></div>
<script type="text/javascript" th:inline="javascript" >

    $(function() {
        var prefix = [[${prefix}]];
        $("#submitBtn").on("click", function () {
            $.freedom.action.request(prefix + "/save.json", $("#dataForm").serialize());
        });

    });

</script>
</body>
</html>
